//I-MR图
<template>
  <div id="myChart" style="height: 300px"></div>
</template>
<script>
  export default {
    mounted() {
      this.init();
    },
    methods: {
      init() {
        let myChart = this.$echarts.init(document.getElementById("myChart"));
        let X = [40, 43, 42, 40, 42, 41, 39, 41, 39, 41, 41, 43, 42, 41, 39, 41, 40, 39, 42, 39, 41, 39, 39, 39, 38];
        let R = [];
        for (let i = 1; i < X.length; i++) {
          R.push(X[i] - X[i - 1]);
        }
        //计算均值
        let mean = 0;
        for (let i = 0; i < X.length; i++) {
          mean += X[i];
        }
        mean /= X.length;
        let option = {
          xAxis: {
            type: 'category',
          },
          yAxis: {
            type: 'value'
          },
          series: [{
            data: X,
            type: 'line'
          }]
        };
        myChart.setOption(option);
      }
    }
  }
</script>
<style scoped>

</style>
